/******************************************************************************* 
 *  Copyright 2007 Amazon Technologies, Inc.  
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  
 *  You may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
 *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the 
 *  specific language governing permissions and limitations under the License.
 * ***************************************************************************** 
 *    __  _    _  ___ 
 *   (  )( \/\/ )/ __)
 *   /__\ \    / \__ \
 *  (_)(_) \/\/  (___/
 * 
 *  Amazon ECS CSharp Library
 *  API Version: 2007-07-16
 *  Generated: Thu Aug 02 10:15:38 PDT 2007 
 * 
 */

using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Text;


namespace Amazon.ECS.Model
{
    [XmlTypeAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16")]
    [XmlRootAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16", IsNullable = false)]
    public class PromotionDetails
    {
    
        private String merchantIdField;

        private String owningMerchantIdField;

        private String promotionIdField;

        private String promotionCategoryField;

        private String merchantPromotionIdField;

        private String groupClaimCodeField;

        private String couponCombinationTypeField;

        private String startDateField;

        private String endDateField;

        private String termsAndConditionsField;

        private  PromotionEligibilityRequirements eligibilityRequirementsField;
        private  PromotionBenefits benefitsField;
        private  PromotionItemApplicability itemApplicabilityField;
        private String merchandisingMessageField;


        /// <summary>
        /// Gets and sets the MerchantId property.
        /// </summary>
        [XmlElementAttribute(ElementName = "MerchantId")]
        public String MerchantId
        {
            get { return this.merchantIdField ; }
            set { this.merchantIdField= value; }
        }



        /// <summary>
        /// Sets the MerchantId property
        /// </summary>
        /// <param name="merchantId">MerchantId property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithMerchantId(String merchantId)
        {
            this.merchantIdField = merchantId;
            return this;
        }



        /// <summary>
        /// Checks if MerchantId property is set
        /// </summary>
        /// <returns>true if MerchantId property is set</returns>
        public Boolean IsSetMerchantId()
        {
            return  this.merchantIdField != null;

        }


        /// <summary>
        /// Gets and sets the OwningMerchantId property.
        /// </summary>
        [XmlElementAttribute(ElementName = "OwningMerchantId")]
        public String OwningMerchantId
        {
            get { return this.owningMerchantIdField ; }
            set { this.owningMerchantIdField= value; }
        }



        /// <summary>
        /// Sets the OwningMerchantId property
        /// </summary>
        /// <param name="owningMerchantId">OwningMerchantId property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithOwningMerchantId(String owningMerchantId)
        {
            this.owningMerchantIdField = owningMerchantId;
            return this;
        }



        /// <summary>
        /// Checks if OwningMerchantId property is set
        /// </summary>
        /// <returns>true if OwningMerchantId property is set</returns>
        public Boolean IsSetOwningMerchantId()
        {
            return  this.owningMerchantIdField != null;

        }


        /// <summary>
        /// Gets and sets the PromotionId property.
        /// </summary>
        [XmlElementAttribute(ElementName = "PromotionId")]
        public String PromotionId
        {
            get { return this.promotionIdField ; }
            set { this.promotionIdField= value; }
        }



        /// <summary>
        /// Sets the PromotionId property
        /// </summary>
        /// <param name="promotionId">PromotionId property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithPromotionId(String promotionId)
        {
            this.promotionIdField = promotionId;
            return this;
        }



        /// <summary>
        /// Checks if PromotionId property is set
        /// </summary>
        /// <returns>true if PromotionId property is set</returns>
        public Boolean IsSetPromotionId()
        {
            return  this.promotionIdField != null;

        }


        /// <summary>
        /// Gets and sets the PromotionCategory property.
        /// </summary>
        [XmlElementAttribute(ElementName = "PromotionCategory")]
        public String PromotionCategory
        {
            get { return this.promotionCategoryField ; }
            set { this.promotionCategoryField= value; }
        }



        /// <summary>
        /// Sets the PromotionCategory property
        /// </summary>
        /// <param name="promotionCategory">PromotionCategory property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithPromotionCategory(String promotionCategory)
        {
            this.promotionCategoryField = promotionCategory;
            return this;
        }



        /// <summary>
        /// Checks if PromotionCategory property is set
        /// </summary>
        /// <returns>true if PromotionCategory property is set</returns>
        public Boolean IsSetPromotionCategory()
        {
            return  this.promotionCategoryField != null;

        }


        /// <summary>
        /// Gets and sets the MerchantPromotionId property.
        /// </summary>
        [XmlElementAttribute(ElementName = "MerchantPromotionId")]
        public String MerchantPromotionId
        {
            get { return this.merchantPromotionIdField ; }
            set { this.merchantPromotionIdField= value; }
        }



        /// <summary>
        /// Sets the MerchantPromotionId property
        /// </summary>
        /// <param name="merchantPromotionId">MerchantPromotionId property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithMerchantPromotionId(String merchantPromotionId)
        {
            this.merchantPromotionIdField = merchantPromotionId;
            return this;
        }



        /// <summary>
        /// Checks if MerchantPromotionId property is set
        /// </summary>
        /// <returns>true if MerchantPromotionId property is set</returns>
        public Boolean IsSetMerchantPromotionId()
        {
            return  this.merchantPromotionIdField != null;

        }


        /// <summary>
        /// Gets and sets the GroupClaimCode property.
        /// </summary>
        [XmlElementAttribute(ElementName = "GroupClaimCode")]
        public String GroupClaimCode
        {
            get { return this.groupClaimCodeField ; }
            set { this.groupClaimCodeField= value; }
        }



        /// <summary>
        /// Sets the GroupClaimCode property
        /// </summary>
        /// <param name="groupClaimCode">GroupClaimCode property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithGroupClaimCode(String groupClaimCode)
        {
            this.groupClaimCodeField = groupClaimCode;
            return this;
        }



        /// <summary>
        /// Checks if GroupClaimCode property is set
        /// </summary>
        /// <returns>true if GroupClaimCode property is set</returns>
        public Boolean IsSetGroupClaimCode()
        {
            return  this.groupClaimCodeField != null;

        }


        /// <summary>
        /// Gets and sets the CouponCombinationType property.
        /// </summary>
        [XmlElementAttribute(ElementName = "CouponCombinationType")]
        public String CouponCombinationType
        {
            get { return this.couponCombinationTypeField ; }
            set { this.couponCombinationTypeField= value; }
        }



        /// <summary>
        /// Sets the CouponCombinationType property
        /// </summary>
        /// <param name="couponCombinationType">CouponCombinationType property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithCouponCombinationType(String couponCombinationType)
        {
            this.couponCombinationTypeField = couponCombinationType;
            return this;
        }



        /// <summary>
        /// Checks if CouponCombinationType property is set
        /// </summary>
        /// <returns>true if CouponCombinationType property is set</returns>
        public Boolean IsSetCouponCombinationType()
        {
            return  this.couponCombinationTypeField != null;

        }


        /// <summary>
        /// Gets and sets the StartDate property.
        /// </summary>
        [XmlElementAttribute(ElementName = "StartDate")]
        public String StartDate
        {
            get { return this.startDateField ; }
            set { this.startDateField= value; }
        }



        /// <summary>
        /// Sets the StartDate property
        /// </summary>
        /// <param name="startDate">StartDate property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithStartDate(String startDate)
        {
            this.startDateField = startDate;
            return this;
        }



        /// <summary>
        /// Checks if StartDate property is set
        /// </summary>
        /// <returns>true if StartDate property is set</returns>
        public Boolean IsSetStartDate()
        {
            return  this.startDateField != null;

        }


        /// <summary>
        /// Gets and sets the EndDate property.
        /// </summary>
        [XmlElementAttribute(ElementName = "EndDate")]
        public String EndDate
        {
            get { return this.endDateField ; }
            set { this.endDateField= value; }
        }



        /// <summary>
        /// Sets the EndDate property
        /// </summary>
        /// <param name="endDate">EndDate property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithEndDate(String endDate)
        {
            this.endDateField = endDate;
            return this;
        }



        /// <summary>
        /// Checks if EndDate property is set
        /// </summary>
        /// <returns>true if EndDate property is set</returns>
        public Boolean IsSetEndDate()
        {
            return  this.endDateField != null;

        }


        /// <summary>
        /// Gets and sets the TermsAndConditions property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TermsAndConditions")]
        public String TermsAndConditions
        {
            get { return this.termsAndConditionsField ; }
            set { this.termsAndConditionsField= value; }
        }



        /// <summary>
        /// Sets the TermsAndConditions property
        /// </summary>
        /// <param name="termsAndConditions">TermsAndConditions property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithTermsAndConditions(String termsAndConditions)
        {
            this.termsAndConditionsField = termsAndConditions;
            return this;
        }



        /// <summary>
        /// Checks if TermsAndConditions property is set
        /// </summary>
        /// <returns>true if TermsAndConditions property is set</returns>
        public Boolean IsSetTermsAndConditions()
        {
            return  this.termsAndConditionsField != null;

        }


        /// <summary>
        /// Gets and sets the EligibilityRequirements property.
        /// </summary>
        [XmlElementAttribute(ElementName = "EligibilityRequirements")]
        public PromotionEligibilityRequirements EligibilityRequirements
        {
            get { return this.eligibilityRequirementsField ; }
            set { this.eligibilityRequirementsField = value; }
        }



        /// <summary>
        /// Sets the EligibilityRequirements property
        /// </summary>
        /// <param name="eligibilityRequirements">EligibilityRequirements property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithEligibilityRequirements(PromotionEligibilityRequirements eligibilityRequirements)
        {
            this.eligibilityRequirementsField = eligibilityRequirements;
            return this;
        }



        /// <summary>
        /// Checks if EligibilityRequirements property is set
        /// </summary>
        /// <returns>true if EligibilityRequirements property is set</returns>
        public Boolean IsSetEligibilityRequirements()
        {
            return this.eligibilityRequirementsField != null;
        }




        /// <summary>
        /// Gets and sets the Benefits property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Benefits")]
        public PromotionBenefits Benefits
        {
            get { return this.benefitsField ; }
            set { this.benefitsField = value; }
        }



        /// <summary>
        /// Sets the Benefits property
        /// </summary>
        /// <param name="benefits">Benefits property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithBenefits(PromotionBenefits benefits)
        {
            this.benefitsField = benefits;
            return this;
        }



        /// <summary>
        /// Checks if Benefits property is set
        /// </summary>
        /// <returns>true if Benefits property is set</returns>
        public Boolean IsSetBenefits()
        {
            return this.benefitsField != null;
        }




        /// <summary>
        /// Gets and sets the ItemApplicability property.
        /// </summary>
        [XmlElementAttribute(ElementName = "ItemApplicability")]
        public PromotionItemApplicability ItemApplicability
        {
            get { return this.itemApplicabilityField ; }
            set { this.itemApplicabilityField = value; }
        }



        /// <summary>
        /// Sets the ItemApplicability property
        /// </summary>
        /// <param name="itemApplicability">ItemApplicability property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithItemApplicability(PromotionItemApplicability itemApplicability)
        {
            this.itemApplicabilityField = itemApplicability;
            return this;
        }



        /// <summary>
        /// Checks if ItemApplicability property is set
        /// </summary>
        /// <returns>true if ItemApplicability property is set</returns>
        public Boolean IsSetItemApplicability()
        {
            return this.itemApplicabilityField != null;
        }




        /// <summary>
        /// Gets and sets the MerchandisingMessage property.
        /// </summary>
        [XmlElementAttribute(ElementName = "MerchandisingMessage")]
        public String MerchandisingMessage
        {
            get { return this.merchandisingMessageField ; }
            set { this.merchandisingMessageField= value; }
        }



        /// <summary>
        /// Sets the MerchandisingMessage property
        /// </summary>
        /// <param name="merchandisingMessage">MerchandisingMessage property</param>
        /// <returns>this instance</returns>
        public PromotionDetails WithMerchandisingMessage(String merchandisingMessage)
        {
            this.merchandisingMessageField = merchandisingMessage;
            return this;
        }



        /// <summary>
        /// Checks if MerchandisingMessage property is set
        /// </summary>
        /// <returns>true if MerchandisingMessage property is set</returns>
        public Boolean IsSetMerchandisingMessage()
        {
            return  this.merchandisingMessageField != null;

        }




        /// <summary>
        /// XML fragment representation of this object
        /// </summary>
        /// <returns>XML fragment for this object.</returns>
        /// <remarks>
        /// Name for outer tag expected to be set by calling method. 
        /// This fragment returns inner properties representation only
        /// </remarks>


        protected internal String ToXMLFragment() {
            StringBuilder xml = new StringBuilder();
            if (IsSetMerchantId()) {
                xml.Append("<MerchantId>");
                xml.Append(EscapeXML(this.MerchantId));
                xml.Append("</MerchantId>");
            }
            if (IsSetOwningMerchantId()) {
                xml.Append("<OwningMerchantId>");
                xml.Append(EscapeXML(this.OwningMerchantId));
                xml.Append("</OwningMerchantId>");
            }
            if (IsSetPromotionId()) {
                xml.Append("<PromotionId>");
                xml.Append(EscapeXML(this.PromotionId));
                xml.Append("</PromotionId>");
            }
            if (IsSetPromotionCategory()) {
                xml.Append("<PromotionCategory>");
                xml.Append(EscapeXML(this.PromotionCategory));
                xml.Append("</PromotionCategory>");
            }
            if (IsSetMerchantPromotionId()) {
                xml.Append("<MerchantPromotionId>");
                xml.Append(EscapeXML(this.MerchantPromotionId));
                xml.Append("</MerchantPromotionId>");
            }
            if (IsSetGroupClaimCode()) {
                xml.Append("<GroupClaimCode>");
                xml.Append(EscapeXML(this.GroupClaimCode));
                xml.Append("</GroupClaimCode>");
            }
            if (IsSetCouponCombinationType()) {
                xml.Append("<CouponCombinationType>");
                xml.Append(EscapeXML(this.CouponCombinationType));
                xml.Append("</CouponCombinationType>");
            }
            if (IsSetStartDate()) {
                xml.Append("<StartDate>");
                xml.Append(EscapeXML(this.StartDate));
                xml.Append("</StartDate>");
            }
            if (IsSetEndDate()) {
                xml.Append("<EndDate>");
                xml.Append(EscapeXML(this.EndDate));
                xml.Append("</EndDate>");
            }
            if (IsSetTermsAndConditions()) {
                xml.Append("<TermsAndConditions>");
                xml.Append(EscapeXML(this.TermsAndConditions));
                xml.Append("</TermsAndConditions>");
            }
            if (IsSetEligibilityRequirements()) {
                PromotionEligibilityRequirements  eligibilityRequirements = this.EligibilityRequirements;
                xml.Append("<EligibilityRequirements>");
                xml.Append(eligibilityRequirements.ToXMLFragment());
                xml.Append("</EligibilityRequirements>");
            } 
            if (IsSetBenefits()) {
                PromotionBenefits  benefits = this.Benefits;
                xml.Append("<Benefits>");
                xml.Append(benefits.ToXMLFragment());
                xml.Append("</Benefits>");
            } 
            if (IsSetItemApplicability()) {
                PromotionItemApplicability  itemApplicability = this.ItemApplicability;
                xml.Append("<ItemApplicability>");
                xml.Append(itemApplicability.ToXMLFragment());
                xml.Append("</ItemApplicability>");
            } 
            if (IsSetMerchandisingMessage()) {
                xml.Append("<MerchandisingMessage>");
                xml.Append(EscapeXML(this.MerchandisingMessage));
                xml.Append("</MerchandisingMessage>");
            }
            return xml.ToString();
        }

        /**
         * 
         * Escape XML special characters
         */
        private String EscapeXML(String str) {
            StringBuilder sb = new StringBuilder();
            foreach (Char c in str)
            {
                switch (c) {
                case '&':
                    sb.Append("&amp;");
                    break;
                case '<':
                    sb.Append("&lt;");
                    break;
                case '>':
                    sb.Append("&gt;");
                    break;
                case '\'':
                    sb.Append("&#039;");
                    break;
                case '"':
                    sb.Append("&quot;");
                    break;
                default:
                    sb.Append(c);
                    break;
                }
            }
            return sb.ToString();
        }




    }

}